package tcln.gxtx.client.utils.date;

import java.util.Date;

/**
 * Interface for a date including time for GWT.
 * 
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public interface GwtDateTime {

    /**
     * Default date format.
     */
    String DEFAULT_DATETIME_FORMAT = GwtDate.DEFAULT_DATE_FORMAT + " HH:mm:ss";

    /**
     * Adds day-of-month.
     * 
     * @param days
     *            The number of dates to add.
     */
    void addDayOfMonth(int days);

    /**
     * Adds months.
     * 
     * @param months
     *            The number of months to add.
     */
    void addMonth(int months);

    /**
     * Adds years.
     * 
     * @param years
     *            The number of years to add.
     */
    void addYear(int years);

    /**
     * Adds hours.
     * 
     * @param hours
     *            The number of hours to add.
     */
    void addHour(int hours);

    /**
     * Adds minutes.
     * 
     * @param minutes
     *            The number of minutes to add.
     */
    void addMinute(int minutes);

    /**
     * Adds seconds.
     * 
     * @param seconds
     *            The number of seconds to add.
     */
    void addSecond(int seconds);

    /**
     * Minuses day-of-month.
     * 
     * @param days
     *            The number of dates to subtract.
     */
    void minusDayOfMonth(int days);

    /**
     * Minuses month.
     * 
     * @param months
     *            The number of months to subtract.
     */
    void minusMonth(int months);

    /**
     * Minuses year.
     * 
     * @param years
     *            The number of years to subtract.
     */
    void minusYear(int years);

    /**
     * Minuses hours.
     * 
     * @param hours
     *            The number of hours to subtract.
     */
    void minusHour(int hours);

    /**
     * Minuses minutes.
     * 
     * @param minutes
     *            The number of minutes to subtract.
     */
    void minusMinute(int minutes);

    /**
     * Minuses seconds.
     * 
     * @param seconds
     *            The number of seconds to subtract.
     */
    void minusSecond(int seconds);

    /**
     * Returns the day of the week represented by this instant. The returned value are: (0 = Sunday, 1 = Monday, 2 =
     * Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday) .
     * 
     * @return
     */
    int getDayOfWeek();

    /**
     * Returns the day of the month represented by this instant. The value returned is between 1 and 31 representing the
     * day of the month.
     * 
     * @return
     */
    int getDayOfMonth();

    /**
     * Returns a value that is the result of subtracting 1900 from the year that contains or begins with the instant in
     * time represented by this object, as interpreted in the local time zone.
     * 
     * @return
     */
    int getYear();

    /**
     * Returns a number representing the month that contains or begins with the instant in time represented by this
     * object. The value returned is between 1 and 12, with the value 1 representing January.
     * 
     * @return
     */
    int getMonth();

    /**
     * Returns the hour represented by this object. The returned value is a number (0 through 23) representing the hour
     * within the day that contains or begins with the instant in time represented by this Date object, as interpreted
     * in the local time zone.
     * 
     * @return
     */
    int getHour();

    /**
     * Returns the number of minutes past the hour represented by this instant, as interpreted in the local time zone.
     * The value returned is between 0 and 59.
     * 
     * @return
     */
    int getMinute();

    /**
     * Returns the number of seconds past the minute represented by this date. The value returned is between 0 and 59.
     * 
     * @return
     */
    int getSecond();

    /**
     * Returns the number of milliseconds since <code><i>January 1, 1970, 00:00:00 GMT</i></code> represented by this
     * instant.
     * 
     * @return
     */
    long getMilliseconds();

    /**
     * Checks if this instant is after given instant according to chronological order.
     * 
     * @param another
     * @return <code>true</code> if this instant is after given instant.
     */
    boolean after(GwtDateTime another);

    /**
     * Checks if this instant is before given instant according to chronological order.
     * 
     * @param another
     * @return <code>true</code> if this instant is before given instant.
     */
    boolean before(GwtDateTime another);

    /**
     * Checks if this instant is equal to given instant according to chronological order.
     * 
     * @param another
     * @return <code>true</code> if this instant = given instant.
     */
    boolean equals(GwtDateTime another);

    /**
     * Checks if this instant is in rage [<i>lower</i>, <i>upper</i>] according to chronological order.
     * 
     * @param lower
     * @param upper
     * @return <code>true</code> if this instant in [<i>lower</i>, <i>upper</i>].
     */
    boolean between(GwtDateTime lower, GwtDateTime upper);

    /**
     * Checks if this instant is in rage (<i>lower</i>, <i>upper</i>) according to chronological order. This means, if
     * this instant = <i>lower</i> or <i>upper</i>, this method should return <code>false</code>.
     * 
     * @param lower
     * @param upper
     * @return <code>true</code> if this instant in [<i>lower</i>, <i>upper</i>].
     */
    boolean betweenExclusive(GwtDateTime lower, GwtDateTime upper);

    /**
     * Formats current date as a string using pattern 'dd.MM.yyyy hh:mm:ss' (Locale-indenpendent).
     * 
     * @return
     */
    String toString();

    /**
     * Formats current date as a string using custom pattern.
     * 
     * @param pattern
     * @return
     */
    String toString(String pattern);

    /**
     * Returns the inner java date.
     * 
     * @return A new {@link Date} which was used inside this GWT date.
     */
    Date toJavaDate();

    /**
     * Returns a new {@link GwtDate} representing the DATE portion of this date/time.
     * 
     * @return
     */
    GwtDate getDate();
}
